<template>
  <div style="margin-top:10px">
    <component-a></component-a>
    <component-b></component-b>
  </div>
</template>
 
<script type="text/javascript">
var ComponentA = {
  data () {
    return {
      input: '',
      select: ''
    }
  },
  methods: {
    handleChange (value) {
      console.log(value)
    }
  },
  template: `
  <el-input placeholder="请输入内容" v-model="input" style="width: 600px" class="input-with-select">
    <el-select v-model="select" slot="prepend" placeholder="请选择">
      <el-option label="餐厅名" value="1"></el-option>
      <el-option label="订单号" value="2"></el-option>
      <el-option label="用户电话" value="3"></el-option>
    </el-select>
    <el-button slot="append" icon="el-icon-search"></el-button>
  </el-input>
  `
}
var ComponentB = {
  data () {
    return {
      num: 1
    }
  },
  methods: {
    handleChange (value) {
      console.log(value)
    }
  },
  template: `
  <el-input-number v-model="num" @change="handleChange" :min=1 :max=10 label="描述文字">
  </el-input-number>
  `
}
 
export default {
  name: 'learn',
  components: {
    'component-a': ComponentA,
    'component-b': ComponentB
  },
  data () {
    return {
      num: 1,
      input: '',
      select: ''
    }
  },
  methods: {
    handleChange (value) {
      alert(value)
    }
  }
}
</script>
 
<style>
.el-select .el-input {
  width: 130px;
}
.input-with-select .el-input-group__prepend {
  background-color: #fff;
}
</style>